﻿// Copyright © Microsoft Corporation.  All Rights Reserved.
// This code released under the terms of the 
// Microsoft Public License (MS-PL, http://opensource.org/licenses/ms-pl.html.)

using System;
using System.Windows.Controls;
using System.Windows.Threading;

namespace TheOliver.Controls
{
    public partial class ClipClapClock : UserControl
    {
        public ClipClapClock()
        {
            InitializeComponent();

            DispatcherTimer _timer = new DispatcherTimer();
            _timer.Tick += new EventHandler(_timer_Tick);
            _timer.Interval += new TimeSpan(0, 0, 1);
            _timer.Start();
        }

        void _timer_Tick(object sender, EventArgs e)
        {
            UpdateTime();
        }

        private void UpdateTime()
        {
            DateTime time = DateTime.Now;
            _hours.Text = time.Hour.ToString("00");
            _minutes.Text = time.Minute.ToString("00");
            _seconds.Text = time.Second.ToString("00");
        }
    }
}
